Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​Threading.​Tasks.​ValueTask<​TResult>
Assembly: System.Runtime
Implemented Interfaces
Provides a value type that wraps a <see cref="T:System.Threading.Tasks.Task`1" /> and a <typeparamref name="TResult" /> , only one of which is used.
Properties
public
bool
IsCanceled
Gets a value that indicates whether this object represents a canceled operation.
public
bool
IsCompleted
Gets a value that indicates whether this object represents a completed operation.
public
bool
IsCompletedSuccessfully
Gets a value that indicates whether this object represents a successfully completed operation.
public
bool
IsFaulted
Gets a value that indicates whether this object represents a failed operation.
public
TResult
Result
Gets the result.
Methods
public
Task<​TResult>
AsTask​()
Retrieves a <see cref="T:System.Threading.Tasks.Task`1" /> object that represents this <see cref="T:System.Threading.Tasks.ValueTask`1" /> .
Returns The <see cref="T:System.Threading.Tasks.Task`1" /> object that is wrapped in this <see cref="T:System.Threading.Tasks.ValueTask`1" /> if one exists, or a new <see cref="T:System.Threading.Tasks.Task`1" /> object that represents the result.
public
Runtime.​CompilerServices.​ConfiguredValueTaskAwaitable<​TResult>
ConfigureAwait​(bool continueOnCapturedContext)
Configures an awaiter for this value.
Returns The configured awaiter.
continueOnCapturedContext
<see langword="true" /> to attempt to marshal the continuation back to the captured context; otherwise, <see langword="false" /> .
public
bool
Equals​(object obj)
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj
The object to compare with the current object.
public
bool
Equals​(ValueTask<​TResult> other)
Determines whether the specified <see cref="T:System.Threading.Tasks.ValueTask`1" /> object is equal to the current <see cref="T:System.Threading.Tasks.ValueTask`1" /> object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
other
The object to compare with the current object.
public
Runtime.​CompilerServices.​ValueTaskAwaiter<​TResult>
GetAwaiter​()
Creates an awaiter for this value.
Returns The awaiter.
public
int
GetHashCode​()
Returns the hash code for this instance.
Returns The hash code for the current object.
public
ValueTask<​TResult>
Preserve​()
Gets a <see cref="T:System.Threading.Tasks.ValueTask`1" /> that may be used at any point in the future.
Returns A task object for future use.
public
string
ToString​()
Returns a string that represents the current object.
Returns A string that represents the current object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .